<template>
  <div>
    <div class="login_input">
      <div class="username_input">
        <img src="../../../assets/img/login/ic_username.png" alt="">
        <van-field
          v-model="username"
          class="field_input" 
          placeholder="请输入Email或小写字母开头6-18位用户名"
          maxlength="18"/>
      </div>
      <div class="code_input">
        <img src="../../../assets/img/login/bt_login_lock.png" alt="">
        <van-field 
          :type="type"
          v-model="password01"
          class="field_input" 
          placeholder="请输入6-18位登陆密码"
          maxlength="18"/>
        <div class="password_eyes" @click="typeClick">
          <img v-if="!typeShow" src="../../../assets/img/login/bt_login_eye.png" alt="">
          <img v-else src="../../../assets/img/login/bt_login_eye_open.png" alt="">
        </div>  
      </div>
      <div class="password_input">
        <img src="../../../assets/img/login/bt_login_lock.png" alt="">
        <van-field 
          :type="typeAgain"
          v-model="password02"
          class="field_input" 
          placeholder="请再次输入密码"
          maxlength="18"/>
        <div class="password_eyes" @click="typeAgainClick">
          <img v-if="!typeAgainShow" src="../../../assets/img/login/bt_login_eye.png" alt="">
          <img v-else src="../../../assets/img/login/bt_login_eye_open.png" alt="">
        </div>  
      </div>
      <van-button round class="login_btn">立即注册</van-button>
      <div class="agreement">
        <span
          :class="[btnFlag ? 'circular-active' : 'circular']"
          @click="btnClick"
        ></span>
        <span
          >注册即同意<a @click="$router.push('/login/user_agreement')">《用户协议》</a
          >和<a @click="$router.push('/login/privacy_agreement')">《隐私协议》</a
          ></span
        >
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: '',
      password01: '',
      password02: '',
      typeShow: false,
      typeAgainShow: false,
      btnFlag: true,
      type: 'password',
      typeAgain: 'password'
    }
  },
  methods: {
    btnClick() {
      this.btnFlag = !this.btnFlag;
    },
    typeClick() {
      if (!this.typeShow) {
        this.typeShow = !this.typeShow
        this.type = 'text'
      }else {
        this.typeShow = !this.typeShow
        this.type = 'password'
      }
    },
    typeAgainClick() {
      if (!this.typeAgainShow) {
        this.typeAgainShow = !this.typeAgainShow
        this.typeAgain = 'text'
      }else {
        this.typeAgainShow = !this.typeAgainShow
        this.typeAgain = 'password'
      }
    },
  },
  
}
</script>

<style lang="less" scoped>
.login_input {
  box-sizing: border-box;
  width: 100%;
  height: 8.213333rem;
  padding: .266667rem .666667rem 1.2rem;
  .username_input {
    display: flex;
    align-items: center;
    img {
      width: .506667rem;
      height: .506667rem;
      margin-right: .333333rem;
    }
    .field_input {
      padding: 0;
      height: 1.173333rem;
      line-height: 1.173333rem;
      font-size: .32rem;
      border-bottom: 1px solid #dddddd;
    }
  }
  .code_input {
    position: relative;
    margin-top: .426667rem;
    display: flex;
    align-items: center;
    img {
      width: .506667rem;
      height: .506667rem;
      margin-right: .333333rem;
    }
    .field_input {
      padding: 0;
      height: 1.173333rem;
      line-height: 1.173333rem;
      font-size: .32rem;
      border-bottom: 1px solid #dddddd;
    }
    .password_eyes {
      position: absolute;
      right: 0;
      top: 50%;
      transform: translateY(-50%);
      width: .506667rem;
      height: .506667rem;
      img {
        display: block;
        width: .506667rem;
        height: .506667rem;
      }
    }
  }
  .password_input {
    position: relative;
    margin-top: .426667rem;
    display: flex;
    align-items: center;
    img {
      width: .506667rem;
      height: .506667rem;
      margin-right: .333333rem;
    }
    .field_input {
      padding: 0;
      height: 1.173333rem;
      line-height: 1.173333rem;
      font-size: .32rem;
      border-bottom: 1px solid #dddddd;
    }
    .password_eyes {
      position: absolute;
      right: 0;
      top: 50%;
      transform: translateY(-50%);
      width: .506667rem;
      height: .506667rem;
      img {
        display: block;
        width: .506667rem;
        height: .506667rem;
      }
    }
  }
}

.login_btn {
  width: 7.813333rem;
  height: 1.173333rem;
  background: linear-gradient(-30deg, #FF5543, #FF7438);
  border-radius: .586667rem;
  margin-top: .533333rem;
  font-size: .4rem;
  color: #fff;
  font-weight: 500;
}


.agreement {
  margin-top: .266667rem;
  display: flex;
  align-items: center;
  font-size: .346667rem;
  color: #666666;
  span {
    font-size: .346667rem;
  }
}

.circular {
  box-sizing: border-box;
  margin-right: .186667rem;
  display: inline-block;
  width: .32rem;
  height: .32rem;
  border: .026667rem solid #999999;
  border-radius: 50%;
}

.circular-active {
  margin-right: .186667rem;
  display: inline-block;
  width: .32rem;
  height: .32rem;
  background: url("../../../assets/img/login/icon_today_active.png") no-repeat;
  background-size: .32rem .32rem;
}

.agreement span a {
  color: #5361FE;
}
</style>